package com.aya.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class ByteChatClientHandler extends SimpleChannelInboundHandler<byte[]> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, byte[] s) throws Exception {
        short  code = (short) (s[1] << 8 | s[0]);
        byte[] body = new byte[s.length-2];

        System.arraycopy(s,2,body,0,body.length);
        System.out.println("fromServer,code:"+code+"body:"+new String(body));
    }
}